import * as TYPES from '../action-types';
import { queryList, createCandidate } from '../../api/candidate';

let candidate = {
    queryList() {
        return async dispatch => {
            let result = await queryList();
            dispatch({
                type: TYPES.CANDIDATE_QUERY_LIST,
                result,
            });
        }
    },
    createCandidate(params) {
        return async dispatch => {
            let result = await createCandidate(params);
            dispatch({
                type: TYPES.CANDIDATE_ADD_TO_LIST,
                result,
            });
        }
    }
};
export default candidate;